<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>
<%@ page import="beans.Manager" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;">
<title>管理员</title>
<link type="text/css" rel=stylesheet href="${pageContext.request.contextPath}\css\userInfo.css">
</head>

<%
Manager manager=(Manager)session.getAttribute("manager");				//获得从Login创建成功的用户对象
String path=request.getContextPath();
String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";		//得到整个文件上下文的基本路径//防止用户因为路径问题照片显示不出来
//System.out.println(basePath);
%>

<body onload="showInfo('用户借书')">

<div id="main">
<div id="header">
<div id="wel">欢迎登录蚌埠学院图书馆</div>
<div id="type">管理员界面</div>
<div id="username">你好:<%=manager.getName() %></div>
<div id="quit"><a href=<%=basePath +"appearence/window.jsp"%> onClick="close()")>退出登录</a></div>
</div>

<div id="select">

<br>
<div id="用户借书" onClick="showInfo(id)"><span>用户借书</span></div>
<br>
<div id="借阅记录" onClick="showInfo(id)"><span>借阅记录</span></div>
<br>
<div id="图书查询" onClick="query(id)"><span>图书查询</span></div>
<br>
<div id="超期书籍" onClick="showInfo(id)"><span>超期书籍</span></div>
<br>
<div id="查看留言" onClick="showInfo(id)"><span>查看留言</span></div>
<br>
<div id="查看公告" onClick="showInfo(id)"><span>查看公告</span></div>
<br>

</div>
<div id="content">
</div>

</div>
</body>
<script>
function query(){
	console.log("query");
	window.open("../bookInfo.jsp");
}

function showInfo(e){
	var url;
	var xmlHttp=new XMLHttpRequest();
	if(e=='用户借书'){
		url="../borrow_book.jsp";
		console.log("test");
	}else if(e=='借阅记录'){
	}
	else if(e=='查看留言'){
		url="servlets/";
	}else if(e=='查看公告'){
		url="servlets/";
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			document.getElementById("content").innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.send();
}
function clear(){
	document.getElementById('alert').innerHTML='';
	console.log('alert');
}
function borrow(){
	//document.getElementById('alert').innerHTML="zhagn";
	var card_num=document.getElementById('card_num').value;
	var ID=document.getElementById('ID').value;
	var url="BorrowBook?card_num="+card_num+"&"+"ID="+ID;
	console.log(url);
	var xmlHttp=new XMLHttpRequest();
	
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			document.getElementById('alert').innerHTML=xmlHttp.responseText;
		}
		
	}
	xmlHttp.send();
}

</script>



</html>